//
//  iSaberView.h
//  
//
//  Created by Fred Havemeyer on 12/30/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>

#import <UIKit/UIKit.h>
#import <UIKit/UIView.h>
#import <UIKit/UITextView.h>

#import "SoundHandler.h"

@interface iSaberView : UIView {
	UITextLabel *xLabel, 
				*yLabel, 
				*zLabel,
				*upDownLabel, 
				*towardAwayLabel,
				*leftRightLabel;
	UITextView *debugView;
	
	UIImageView *background;
	
	UINavigationBar *navBar;
	NSString *rightTitle;
	
	NSTimer *_sampleTimer;
	
	// Saber state
	BOOL saberOn; // if true, its on, if !, its off
	BOOL saberTurningOn;
	
	// For playing sounds
	SoundHandler *_soundHandler;
	
	// Force calculation variables
	float cVals[3]; // Current values
	float dVals[3]; // Delta values
	float pVals[3]; // Previous values
	
	// Debug / dev variables
	BOOL debugMode;
}
- (id)initWithFrame:(struct CGRect)rect;
- (void)dealloc;
- (void)timerTick:(NSTimer *)timer;
- (void)setXLabel:(NSString *)string;
- (void)setYLabel:(NSString *)string;
- (void)setZLabel:(NSString *)string;
- (void)setUpDownLabel:(NSString *)string;
- (void)setLeftRightLabel:(NSString *)string;
- (void)settowardAwayLabel:(NSString *)string;
- (void)addDebugText:(NSString *)string;
- (void)clearDebugText;
@end

typedef struct {} *IOHIDEventSystemRef;
typedef struct {} *IOHIDEventRef;
float IOHIDEventGetFloatValue(IOHIDEventRef ref, int param);
void handleHIDEvent(int a, int b, int c, IOHIDEventRef ptr);
void initialize(int hz);